// import React from 'react';
// const urlPrefix='http://10.31.161.18:3000/';
// const apiGetAllFlatListData =urlPrefix+`product?_sort=id&_order=desc`;
// export const getAllFlatListData=async()=>{
//     try{
//         let response=await fetch(apiGetAllFlatListData);
//         let responseData=await response.json();
//         return responseData;
//     }catch(error){
//         console.log(error);
//     }
// }
// export const getPageFlatListData=async(params={page:1})=>{
//     try{
//         let response=await fetch(apiGetAllFlatListData+'&_limit=5&_page='+params.page);
//         let responseData=await response.json();
//         return responseData;

//     }catch(error){
//         console.log(error);
//     }
// }


import React from 'react';
import Axios from 'axios';

const apiGetAllListData='http://10.31.161.18:3000/product/list';

// export const getAllFlatLiatData=async()=>{
//     try{
//         let response = await fetch(apiGetAllListData);
//         let responseData = await response.json();
//         return responseData
//     }catch(error){
//         console.log(error);
//     }
// }

export const getPageFlatListData =async(params={page:1})=>{
    try {
        let response=await Axios({
            url:apiGetAllListData,
            method:'post',
            data:{
                page:params.page
            }
        });
        let responseData=await response.data.rows;
        return responseData
    } catch (error) {
        console.log(error);
    }
}